namespace CodeConsult.Nordic.nRF8001.ApplicationControlInterface.Commands.SystemCommands
{
    public class EchoCommand : AciCommandBase
    {
        public const byte OpCode = 0x02;

        public byte[] Data { get; set; }

        protected override void EncodeBuffer()
        {
            var length = (byte)Data.Length;
            Error = Data == null || length > 29;

            if (Error) return;

            EncodeBufferWithCommandHeader(OpCode, length);
            EncodeHelper.SetBytes(Data);
        }
    }
}
